﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace WP7Client.Classes
{
    public class ChatMessage
    {
        #region Members

        private Boolean _Incoming = false;
        private Boolean _OutgoingAndValid = false;
        private Boolean _IsRead = false;
        private DateTime _Timestamp;
        private String _Message;
        private String _From;
        private String _To;

        #endregion

        #region Get&Set

        public Boolean Incoming
        {
            get { return _Incoming; }
            set { _Incoming = value; }
        }

        public Boolean OutgoingAndValid
        {
            get { return _OutgoingAndValid; }
            set { _OutgoingAndValid = value; }
        }

        public Boolean IsRead
        {
            get { return _IsRead; }
            set { _IsRead = value; }
        }

        public String Message
        {
            get { return _Message; }
            set { _Message = value; }
        }

        public DateTime Timestamp
        {
            get { return _Timestamp; }
            set { _Timestamp = value; }
        }

        public String ChatFriendlyTimestamp
        {
            get {
                if (Timestamp.Date == DateTime.Now.Date)
                {
                    DateTime d = new DateTime(Timestamp.TimeOfDay.Ticks);
                    return d.ToString("HH:mm");
                }
                else
                    return Timestamp.Date.ToString("HH:mm");
            }
        }

        public String From
        {
            get { return _From; }
            set { _From = value; }
        }

        public String To
        {
            get { return _To; }
            set { _To = value; }
        }

        #endregion

        /// <summary>
        /// Creëert een nieuw leeg chatbericht
        /// </summary>
        public ChatMessage() { }

        /// <summary>
        /// Creëert een nieuw chatbericht
        /// </summary>
        /// <param name="message">Het bericht</param>
        public ChatMessage(String message) { this._Message = message; }

        /// <summary>
        /// Creëert een nieuw chatbericht
        /// </summary>
        /// <param name="message">Het bericht</param>
        /// <param name="incoming">Geeft aan of het een inkomend bericht is of niet</param>
        public ChatMessage(String message, Boolean incoming) { this._Message = message; this._Incoming = incoming; }

        /// <summary>
        /// Creëert een nieuw chatbericht
        /// </summary>
        /// <param name="message">Het bericht</param>
        /// <param name="incoming">Geeft aan of het een inkomend bericht is of niet</param>
        /// <param name="timestamp">De datum en tijd wanneer het bericht verstuurd is</param>
        public ChatMessage(String message, Boolean incoming, DateTime timestamp) { this._Message = message; this._Incoming = incoming; this._Timestamp = timestamp; }
    }
}
